<?php

function __autoload($class) {
	$class = strtolower($class);
	$plain = str_replace('model','',$class);
	$file = (eregi('model',$class)) ? 'models/'.$plain.'/'.$plain.'.php' : 'libraries/'.$class.'/'.$class.'.php';
	
	if(file_exists($file)) {
		require_once($file);
		return true;
	}
	return false;
}

?>